package com.nuaa.dao.transfer.impl;

import java.util.Date;

import javax.transaction.Transactional;

import org.springframework.stereotype.Repository;

import com.nuaa.dao.base.impl.BaseDaoImpl;
import com.nuaa.dao.transfer.inter.TransferDaoInter;
import com.nuaa.domain.transfer.TransferEntity;
import com.nuaa.utils.AjaxMsg;
import com.nuaa.utils.CustomCodeUtil;
@Repository("transferDao")
public class TransferDaoImpl extends BaseDaoImpl<TransferEntity,Integer> implements TransferDaoInter{
	/**提交一条中转订单信息*/
	@Transactional
	@Override
	public AjaxMsg saveTransferOrder(TransferEntity entity) {
		AjaxMsg msg = new AjaxMsg();
		try{
			String CH_NO = CustomCodeUtil.getTransferOrderNo(this.getMaxId(entity.getClass()));
			entity.setOrder_no(CH_NO);
		
			entity.setCreate_tm(new Date());
			entity.setBusiness_type("FBA中转业务");
			this.save(entity);
			msg.setSuccess(true);
			msg.setResult(CH_NO);
			msg.setMsg("提交成功！");
		}catch(Exception e){
			e.printStackTrace();
			msg.setMsg("提交失败！");
			msg.setSuccess(false);
		}
		return msg;
	}
}
